# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php7-pecl-ssh2
_extname=ssh2
pkgver=1.3.1
pkgrel=0
pkgdesc="PHP 7 extension provide bindings for the libssh2 library - PECL"
url="https://pecl.php.net/package/ssh2"
arch="all"
license="PHP-3.01"
depends="php7-common"
makedepends="php7-dev libssh2-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"
provides="php7-ssh2=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-ssh2" # for backward compatibility

build() {
	phpize7
	./configure --prefix=/usr --with-php-config=php-config7
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test
	# Check extension loading, testsuite skips tests if extension broken
	php7 -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php7/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="c74d4f699853148b53cdca0eaf8837bfdbdd21d185761606acadf2442e84dbefdb00cde207e0ce4794ae1e4f8692a38ed903b6d11fdc57bca7b54a4250da9a76  php-pecl-ssh2-1.3.1.tgz"
